//
//  QJChangeLoginPasswordVC.m
//  QuanJieShopProject
//
//  Created by 刘中义 on 2018/2/25.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "QJChangeLoginPasswordVC.h"

@interface QJChangeLoginPasswordVC ()

@end

@implementation QJChangeLoginPasswordVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title = @"修改密码";
    self.oneView.layer.borderWidth = 0.5;
    self.oneView.layer.borderColor = HexRGB(0x29b5de).CGColor;
    self.oneView.layer.cornerRadius = 2;
    self.oneView.layer.masksToBounds = YES;
    self.twoView.layer.borderWidth = 0.5;
    self.twoView.layer.borderColor = HexRGB(0x29b5de).CGColor;
    self.twoView.layer.cornerRadius = 2;
    self.twoView.layer.masksToBounds = YES;
    self.threeView.layer.borderWidth = 0.5;
    self.threeView.layer.borderColor = HexRGB(0x29b5de).CGColor;
    self.threeView.layer.cornerRadius = 2;
    self.threeView.layer.masksToBounds = YES;
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self setNavAlpha:YES];
    //控件不被导航栏遮挡
    self.navigationController.navigationBar.translucent = NO;
    self.view.backgroundColor = HexRGB(0xe6e6e6);
}
- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [self setNavAlpha:NO];
    self.navigationController.navigationBar.translucent = YES;
}
- (IBAction)okBtnClickAction:(UIButton *)sender {
    NSString *oneStr = self.oneTF.text;
    NSString *twoStr = self.twoTF.text;
    NSString *threeStr = self.threeTF.text;
    if (oneStr.length > 0 && twoStr.length > 0 && threeStr.length > 0 && [twoStr isEqualToString:threeStr] && twoStr.length > 5 && twoStr.length < 17) {
        
        NSMutableDictionary *dict = [NSMutableDictionary dictionary];
        
        [dict setObject:oneStr forKey:@"old_password"];
        [dict setObject:twoStr forKey:@"new_password"];
        [dict setObject:threeStr forKey:@"confirm_password"];
        
        
        [WWNetRequest fetchChangePasswordWithParameters:dict success:^(id response) {
            if (response) {
                [MBPHUD showAlertWithTitle:@"密码修改成功!"];
                KPopViewControllerAction;
            }
        } failure:^(NSDictionary *error) {
            
            
            
        }];
    }else{
        [MBPHUD showAlertWithTitle:@"您的密码输入不符合标准!"];
    }
}

@end
